<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>mgrs-utils - Documentation</title>

    <script src="scripts/prettify/prettify.js"></script>
    <script src="scripts/prettify/lang-css.js"></script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
</head>
<body>

<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
  <div class="navicon"></div>
</label>

<label for="nav-trigger" class="overlay"></label>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="LabelElement.html">LabelElement</a></li><li><a href="module-labeling-utils-GridPolygon.html">GridPolygon</a></li><li><a href="module-mgrs-utils-NonPolarGridZone.html">NonPolarGridZone</a><ul class='methods'><li data-type='method'><a href="module-mgrs-utils-NonPolarGridZone.html#toPolygon">toPolygon</a></li><li data-type='method'><a href="module-mgrs-utils-NonPolarGridZone.html#toPolyline">toPolyline</a></li></ul></li><li><a href="module-mgrs-utils-VisibleGridZone.html">VisibleGridZone</a><ul class='methods'><li data-type='method'><a href="module-mgrs-utils-VisibleGridZone.html#getCenterLabel">getCenterLabel</a></li><li data-type='method'><a href="module-mgrs-utils-VisibleGridZone.html#getLabels">getLabels</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-constants.html">constants</a></li><li><a href="module-geometry-utils.html">geometry-utils</a><ul class='methods'><li data-type='method'><a href="module-geometry-utils.html#~extentToPolygon">extentToPolygon</a></li><li data-type='method'><a href="module-geometry-utils.html#~pointToGeographic">pointToGeographic</a></li><li data-type='method'><a href="module-geometry-utils.html#~polygonToPolyline">polygonToPolyline</a></li><li data-type='method'><a href="module-geometry-utils.html#~toGeographic">toGeographic</a></li><li data-type='method'><a href="module-geometry-utils.html#~toWebMercator">toWebMercator</a></li></ul></li><li><a href="module-labeling-utils.html">labeling-utils</a><ul class='methods'><li data-type='method'><a href="module-labeling-utils.html#~distanceFromMapEdge">distanceFromMapEdge</a></li><li data-type='method'><a href="module-labeling-utils.html#~getScreenSize">getScreenSize</a></li><li data-type='method'><a href="module-labeling-utils.html#~getWidthOfText">getWidthOfText</a></li><li data-type='method'><a href="module-labeling-utils.html#~padZero">padZero</a></li><li data-type='method'><a href="module-labeling-utils.html#~screenDistanceBetweenPoints">screenDistanceBetweenPoints</a></li></ul></li><li><a href="module-mgrs-utils.html">mgrs-utils</a><ul class='methods'><li data-type='method'><a href="module-mgrs-utils.html#~getInterval">getInterval</a></li><li data-type='method'><a href="module-mgrs-utils.html#~handle100kGrids">handle100kGrids</a></li><li data-type='method'><a href="module-mgrs-utils.html#~handleIntervals">handleIntervals</a></li><li data-type='method'><a href="module-mgrs-utils.html#~handleZonePolygon">handleZonePolygon</a></li><li data-type='method'><a href="module-mgrs-utils.html#~processZonePolygons">processZonePolygons</a></li><li data-type='method'><a href="module-mgrs-utils.html#~zonesFromExtent">zonesFromExtent</a></li></ul></li></ul><h3>Externals</h3><ul><li><a href="external-Color.html">Color</a></li><li><a href="external-Extent.html">Extent</a></li><li><a href="external-Font.html">Font</a></li><li><a href="external-Geometry.html">Geometry</a></li><li><a href="external-Graphic.html">Graphic</a></li><li><a href="external-GraphicsLayer.html">GraphicsLayer</a></li><li><a href="external-Map.html">Map</a></li><li><a href="external-Point.html">Point</a></li><li><a href="external-Polygon.html">Polygon</a></li><li><a href="external-Polyline.html">Polyline</a></li><li><a href="external-SpatialReference.html">SpatialReference</a></li><li><a href="external-TextSymbol.html">TextSymbol</a></li></ul>
</nav>

<div id="main">
    
    <h1 class="page-title">mgrs-utils</h1>
    

    




<section>

<header>
    
        
            
        
    
</header>

<article>
    <div class="container-overview">
    
        
            <div class="description"><p>Module containing MGRS grid utilities used by GridOverlay widgets.</p></div>
        

        
            




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_mgrs-utils.js.html">lib/mgrs-utils.js</a>, <a href="lib_mgrs-utils.js.html#line6">line 6</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





























        
    
    </div>

    

    

    
        <h3 class="subsection-title">Classes</h3>

        <dl>
            <dt><a href="module-mgrs-utils-NonPolarGridZone.html">NonPolarGridZone</a></dt>
            <dd></dd>
        
            <dt><a href="module-mgrs-utils-VisibleGridZone.html">VisibleGridZone</a></dt>
            <dd></dd>
        </dl>
    

     

    

    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <h4 class="name" id="~getInterval"><span class="type-signature">(inner) </span>getInterval<span class="signature">(minSpacing, map, detail<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Number}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_mgrs-utils.js.html">lib/mgrs-utils.js</a>, <a href="lib_mgrs-utils.js.html#line193">line 193</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Determines which MGRS grid interval (in meters) supports the current map extent</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>minSpacing</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>The minimum spacing of lines (in screen pixels)</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>map</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="external-Map.html">external:Map</a></span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>A Map object</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>detail</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>Either &quot;more&quot; or &quot;less&quot;.  For example, when close to the minSpacing threshhold, which way to lean (i.e. &quot;more&quot; detail or &quot;less&quot; detail).  This effects the way rounding is dones within this function.</p></td>
        </tr>

    
    </tbody>
</table>














<h5>Returns:</h5>

        
<div class="param-desc">
    <p>The minimum spacing of lines (in meters)</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Number</span>


    </dd>
</dl>

    


        
            

    

    <h4 class="name" id="~handle100kGrids"><span class="type-signature">(inner) </span>handle100kGrids<span class="signature">(args)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_mgrs-utils.js.html">lib/mgrs-utils.js</a>, <a href="lib_mgrs-utils.js.html#line547">line 547</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-todo">To Do:</dt>
    <dd class="tag-todo">
        <ul>
            <li>Implement configurable parameter for when to label (center and corners), based on zoom</li>
        </ul>
    </dd>
    
</dl>





<div class="description">
    <p>Creates graphics and labels for the 100K meter grids</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>args</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="module-mgrs-utils.html#~MgrsGridHandlerArguments">module:mgrs-utils~MgrsGridHandlerArguments</a></span>


            
            </td>

            

            

            <td class="description last"><p>An object holding the arguments for the various handlers</p></td>
        </tr>

    
    </tbody>
</table>
















        
            

    

    <h4 class="name" id="~handleIntervals"><span class="type-signature">(inner) </span>handleIntervals<span class="signature">(args)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_mgrs-utils.js.html">lib/mgrs-utils.js</a>, <a href="lib_mgrs-utils.js.html#line674">line 674</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Creates graphics and labels for grid interval lines (i.e. lines at less than 100K meter spacing)</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>args</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="module-mgrs-utils.html#~MgrsGridHandlerArguments">module:mgrs-utils~MgrsGridHandlerArguments</a></span>


            
            </td>

            

            

            <td class="description last"><p>An object holding the arguments for the various handlers</p></td>
        </tr>

    
    </tbody>
</table>
















        
            

    

    <h4 class="name" id="~handleZonePolygon"><span class="type-signature">(inner) </span>handleZonePolygon<span class="signature">(visibleGridZone, grid)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_mgrs-utils.js.html">lib/mgrs-utils.js</a>, <a href="lib_mgrs-utils.js.html#line486">line 486</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-todo">To Do:</dt>
    <dd class="tag-todo">
        <ul>
            <li>Implement configurable parameter for when to label (center and corners), based on zoom</li>
        </ul>
    </dd>
    
</dl>





<div class="description">
    <p>Creates graphics and labels for a visible grid zone</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>visibleGridZone</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="module-mgrs-utils-VisibleGridZone.html">module:mgrs-utils~VisibleGridZone</a></span>


            
            </td>

            

            

            <td class="description last"><p>A VisibleGridZone object</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>grid</code></td>
            

            <td class="type">
            
                
<span class="param-type">object</span>


            
            </td>

            

            

            <td class="description last"><p>The grid overlay object that is calling this method</p></td>
        </tr>

    
    </tbody>
</table>
















        
            

    

    <h4 class="name" id="~processZonePolygons"><span class="type-signature">(inner) </span>processZonePolygons<span class="signature">(visibleGridZone, grid)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_mgrs-utils.js.html">lib/mgrs-utils.js</a>, <a href="lib_mgrs-utils.js.html#line386">line 386</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Processes an array of visible grid zone and hands them off to the appropriate handler(s)</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>visibleGridZone</code></td>
            

            <td class="type">
            
                
<span class="param-type">Array.&lt;<a href="module-mgrs-utils-VisibleGridZone.html">module:mgrs-utils~VisibleGridZone</a>></span>


            
            </td>

            

            

            <td class="description last"><p>A VisibleGridZone object</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>grid</code></td>
            

            <td class="type">
            
                
<span class="param-type">object</span>


            
            </td>

            

            

            <td class="description last"><p>The grid overlay object that is calling this method</p></td>
        </tr>

    
    </tbody>
</table>
















        
            

    

    <h4 class="name" id="~zonesFromExtent"><span class="type-signature">(inner) </span>zonesFromExtent<span class="signature">(grid)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="module-mgrs-utils-VisibleGridZone.html">module:mgrs-utils~VisibleGridZone</a>>}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_mgrs-utils.js.html">lib/mgrs-utils.js</a>, <a href="lib_mgrs-utils.js.html#line261">line 261</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Finds the intersecting MGRS grid zones that are visible in an extent</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>grid</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last"><p>The grid overlay object</p></td>
        </tr>

    
    </tbody>
</table>














<h5>Returns:</h5>

        
<div class="param-desc">
    <p>An array of non-polar grid zones</p>
</div>



<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Array.&lt;<a href="module-mgrs-utils-VisibleGridZone.html">module:mgrs-utils~VisibleGridZone</a>></span>


    </dd>
</dl>

    


        
    

    
        <h3 class="subsection-title">Type Definitions</h3>

        
                
<h4 class="name" id="~MgrsGridHandlerArguments">MgrsGridHandlerArguments</h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_mgrs-utils.js.html">lib/mgrs-utils.js</a>, <a href="lib_mgrs-utils.js.html#line528">line 528</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>



    <h5 class="subsection-title">Properties:</h5>

    

<table class="props">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>polygon</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="external-Polygon.html">external:Polygon</a></span>


            
            </td>

            

            

            <td class="description last"><p>A geometry Polygon object that represents the visible grid zone</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>utmZone</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"><p>The UTM zone number</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>offset</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"><p>The non-normalized x-offset of the grid</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>minE</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"><p>The minimum UTM easting of the visible zone</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>maxE</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"><p>The maximum UTM easting of the visible zone</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>minN</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"><p>The minimum UTM northing of the visible zone</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>maxN</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"><p>The maximum UTM northing of the visible zone</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>grid</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last"><p>The grid object that is being processed</p></td>
        </tr>

    
    </tbody>
</table>






<div class="description">
    <p>An object that contains arguments used during 100K and interval handler methods, allowing objects to be passed by reference</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Object</span>


        </li>
    </ul>






            
                
<h4 class="name" id="~NonPolarGridZoneArguments">NonPolarGridZoneArguments</h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="lib_NonPolarGridZone.js.html">lib/NonPolarGridZone.js</a>, <a href="lib_NonPolarGridZone.js.html#line18">line 18</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>



    <h5 class="subsection-title">Properties:</h5>

    

<table class="props">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>properties.id</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>The MGRS grid zone ID (e.g. &quot;12S&quot;)</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>properties.xmin</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>The minimum longitude of the grid zone (-180 =&gt; 174)</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>properties.ymin</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>The minimum latitude of the grid zone (-80 =&gt; 72)</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>properties.xmax</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>The maximum longitude of the grid zone (-174 =&gt; 180)</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>properties.ymax</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            
                <td class="attributes">
                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>The maximum latitude of the grid zone (-72 =&gt; 84)</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>properties.spatialReference</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="external-SpatialReference.html">external:SpatialReference</a></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                
                </td>
            

            
                <td class="default">
                
                    <code>{wkid: 4326}</code>
                
                </td>
            

            <td class="description last"><p>The spatial referencence object</p></td>
        </tr>

    
    </tbody>
</table>






<div class="description">
    <p>An object that contains arguments used during NonPolarGridZone construction</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Object</span>


        </li>
    </ul>






            
    

    
</article>

</section>




</div>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>